package com.kupurui.asteacher.ui.mine.person;

import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;

import com.kupurui.asteacher.R;
import com.kupurui.asteacher.ui.BaseAty;
import com.kupurui.asteacher.utils.UserManger;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;
import info.hoang8f.widget.FButton;

/**
 * 手机号码
 * Created by Administrator on 2017/7/18.
 */

public class PhoneValidationAty extends BaseAty {

    @Bind(R.id.tv_bar_title)
    TextView tvBarTitle;
    @Bind(R.id.m_toolbar)
    Toolbar mToolbar;
    @Bind(R.id.tv_current_phone)
    TextView tvCurrentPhone;
    @Bind(R.id.fbtn_change_phone)
    FButton fbtnChangePhone;

    @Override
    public int getLayoutId() {
        return R.layout.phone_validation_aty;
    }

    @Override
    public void initData() {
        initToolbar(mToolbar,"手机号码");
    }

    @Override
    public void requestData() {
        String phone = UserManger.getUserInfo().getPhone();
        StringBuilder sb  =new StringBuilder();
        for (int i = 0; i < phone.length(); i++) {
            char c = phone.charAt(i);
            if (i >= 3 && i <= 6) {
                sb.append('*');
            } else {
                sb.append(c);
            }
        }
        tvCurrentPhone.setText(sb.toString());
    }

    @OnClick({R.id.fbtn_change_phone})
    @Override
    public void onClick(View view) {
        super.onClick(view);
        switch (view.getId()){
            case R.id.fbtn_change_phone:
                startActivity(PhoneChangeAty.class,null);
                break;
        }
    }
}
